Ext.define('Admin.view.menu.MenuGridPanel', {
    extend: 'Ext.grid.Panel',
    xtype: 'menuGridPanel',
    id:'menuGridPanel',
    	
    requires: [
    	//'Ext.grid.column.RowNumberer',
    	'Ext.selection.CheckboxModel'
    ],
    title: '用户列表',
    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
	bind: '{menuDataList}',
 	selModel: {
		selType: 'checkboxmodel',
        checkOnly: true,
        showHeaderCheckbox: true
    },
    //multiSelect: true,
     dockedItems: [{
        xtype: 'toolbar',
        items: [{
	        xtype: 'combobox',
	        fieldLabel: '',
	        name: 'searchFieldName',
	        reference:'searchFieldName',
	        store: {
	            proxy: {
	                type: 'memory',
	                reader: 'array'
	            },
	            fields: [ 'key', 'value'],
	            data: [
	                ['菜单名称', 'text'],
	                ['图标类型', 'iconCls'],
                    ['视图链接', 'viewType']
	            ]
	        },
	        queryMode: 'local',
	        displayField: 'key',
	        valueField: 'value',
	       	value:'请选择',
	        allowBlank: false,
            editable:false
	    },'-',{
            xtype: 'textfield',
            name:'searchFieldValue',
            reference:'searchFieldValue'
        },'-',{
            text:'查询',
            tooltip:'查询',
            iconCls:'x-fa fa-search',
            handler : 'search'
        },'-',{
            text:'添加菜单',
            tooltip:'添加',
            iconCls:'x-fa fa-plus',
            handler : 'openAddWindow'
        }]
    }],
    columns: [
    		//{xtype: 'rownumberer',width: 40, sortable: false},
    		
         
		 { header: 'ID',  dataIndex: 'treeId',width: 120},
         { header: '父节点',  dataIndex: 'fatherId',width: 120},
         { header: '菜单名称',  dataIndex: 'text' ,width: 120},
          { header: '图标类型',  dataIndex: 'iconCls' ,width: 120},
          { header: '是否模块',  dataIndex: 'leaf' ,width: 120},
         { header: '视图链接', dataIndex: 'viewType', flex: 1 ,sortable: false},{
            xtype: 'actioncolumn',
            items: [{
                xtype: 'button',
                tooltip:'编辑',
                iconCls: 'x-fa fa-pencil',
                handler : 'openEditWindow'
            },{
                xtype: 'button',
                tooltip:'删除',
                iconCls: 'x-fa fa-trash',
                handler : 'deleteMenu'
            }],
            cls: 'content-column',
            width: 120,
            //dataIndex: 'bool',
            text: '操作',
            tooltip: '操作 '
          }],
         columnLines: true,
	   bbar: {
	    xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{menuDataList}',
        displayInfo: true,
        displayMsg: '{0} - {1} of {2}',
        emptyMsg: "No topics to display",
        items:[
            '-', {
            text: '批量删除',
            listeners: {
			    click:'deleteMenus'
			}
        }]
    }
});